<%@page import="java.util.Date"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="service.Utils"%>
<%
	request.setCharacterEncoding("utf-8");
%>
<%
Domain domain = (Domain) request.getAttribute("domain");
String pr = (String) request.getAttribute("pr");
String name = (String) request.getAttribute("name");
String title = domain.getName();
String description = domain.getName()+"Find infomation about domain,lookup ip,check pagerank,network tool,qr code";
String keywords = domain.getName()+",lookup ip,check pagerank,network tool,qr code";
if(domain.getTitle() != null&&!domain.getTitle().getValue().equals("null"))
{
	title = domain.getName()+", "+domain.getTitle().getValue();
}
if(domain.getDescription() != null&&!domain.getDescription().getValue().equals("null")&&domain.getDescription().getValue().length()>50)
{
	description = domain.getDescription().getValue();
}
if(description.length()>200)
	description=description.substring(0,190);
if(domain.getKeyword() != null&&!domain.getKeyword().getValue().equals("null")&&domain.getKeyword().getValue().length()>50)
{
	keywords = domain.getKeyword().getValue();
}
if(keywords.length()>200)
	keywords=keywords.substring(0,190);
NumberFormat format = NumberFormat.getInstance();

long date = new Date().getTime();
long dates = new Date().getTime();
if(domain.getLastUpdate() != null)
{
	dates = Long.parseLong(domain.getLastUpdate().getValue());
}
long seconds = (date - dates)/1000;
long day = (int) (seconds / 86400);
long hour = (int) ((seconds - day*86400) / 3600);
long minute = (int) ((seconds - day*86400 - hour*3600) / 60);
if(hour<0)
{
	hour = 0;	
}
if(minute<0)
{
	minute = 0;	
}
if(day<0)
{
	day = 0;	
}

%>
<jsp:include page="/layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
</jsp:include>
		<div class="content clear">
			<div class="content-left left">
					<img src="http://chart.apis.google.com/chart?chs=120x100&amp;cht=qr&amp;chld=|0&amp;chl=http://<%=domain.getName() %>" class="left"/>
					<h1 class="title" itemprop="name"><%=domain.getName() %></h1>
					<p>
						<%=(domain.getTitle() != null&&!domain.getTitle().getValue().equals("null"))?domain.getTitle().getValue():"" %><br/>
						<strong>Description: </strong><%=(domain.getDescription() != null&&!domain.getDescription().getValue().equals("null"))?domain.getDescription().getValue():"" %>
					</p>
					<div class="clear"></div>
					<p>Updated<b>
					<%
						if(day > 0)
						{
							out.print(day+" days, ");
						}
						if(hour > 0)
						{
							out.print(hour+" hours, ");
						}
						out.print(minute+" minutes");
					%>	
					</b> Ago</p>
				
				
				<hr size="2" color="#0B6CB4" class="margin-bottom"/>
				<div class="left"><img src="/images/images.jpg"/></div>
				<div class="addthis_toolbox addthis_default_style right">
					<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
					<a class="addthis_button_tweet" tw:via="yunievu"></a> <a
						class="addthis_button_google_plusone" g:plusone:size="medium"></a> 
						<a class="addthis_counter addthis_pill_style"></a>
				</div>
				<div class="clear"></div>
				<div class="pr margin-top margin-bottom">
					<strong><%=domain.getName() %></strong> has google pagerank is <strong>#<%=(domain.getGoogle() != null&&!domain.getGoogle().getValue().equals("null"))?domain.getGoogle().getValue():"0" %></strong>, rank alexa is <strong><%=(domain.getAlexa() != 0)?format.getInstance().format(domain.getAlexa()):"-" %></strong>.
				</div>
				<h3 class="info-menu">Site info</h3>
				<table width="100%" class="margin-bottom">
					<tr>
						<td width="30%">Domain name:</td>
						<td><i><%=domain.getName() %></i></td>
					</tr>
					<tr>
						<td width="30%">Favicon:</td>
						<td><img src="https://s2.googleusercontent.com/s2/favicons?domain_url=http://<%=domain.getName() %>"></td>
					</tr>
					
					<tr>
						<td>Keywords:</td>
						<td><%=(domain.getKeyword() != null&&!domain.getKeyword().getValue().equals("null"))?domain.getKeyword().getValue():"No keyword" %></td>
					</tr>
					<tr>
						<td>Popular Keywords:</td>
						<td><%=(domain.getPopularKeyword() != null&&!domain.getPopularKeyword().getValue().equals("null"))?domain.getPopularKeyword().getValue():"No popular keyword" %></td>
					</tr>
					
					<tr>
						<td>Site Category:</td>
						<td><%=(domain.getCategory() != null&&!domain.getCategory().getValue().equals("null"))?domain.getCategory().getValue():"" %></td>
					</tr>
				</table>
				<h3 class="info-menu margin-bottom">Look up information</h3>
				<div class="blog-info left adv">
					<%@ include file='/adv/adv300c.jsp'%>	
				</div>
				<div class="blog-info right">
					<ul class="item">
						<li><a href="/pagerank?url=<%=domain.getName()%>" rel="nofollow">Check pagerank</a></li>
						<li><a href="/network-tool?url=<%=domain.getName()%>&type=dnsrec" rel="nofollow">DNS Records</a></li>
						<li><a href="/network-tool?url=<%=domain.getName()%>&type=ping" rel="nofollow">Ping</a></li>
						<li><a href="/network-tool?url=<%=domain.getName()%>&type=lookup" rel="nofollow">Lookup</a></li>
						<li><a href="/network-tool?url=<%=domain.getName()%>&type=trace" rel="nofollow">Trace</a></li>
						<li><a href="/network-tool?url=<%=domain.getName()%>&type=httphead" rel="nofollow">HTTP Headers</a></li>
						<li><a href="/domain-start/<%=domain.getStartName()%>" >Domain start with <%=domain.getStartName()%></a></li>
						<li><a href="/domain-other/<%=domain.getDomain()%>">Other domain of <%=domain.getDomain()%></a></li>
						<%
						if(domain.getIp() != null&&!domain.getIp().equals("null"))
						{
						%>
						<li><a href="/same-ip/<%=domain.getIp()%>">Domain same ip <%=domain.getIp()%></a></li>
						<li><a href="/lookup-ip?ip=<%=domain.getIp()%>" rel="nofollow">Lookup ip <%=domain.getIp()%></a></li>
						<%
						}
						%>
					</ul>
				</div>
				<h3 class="info-menu">Site Technical Info</h3>
				<table width="100%" class="margin-bottom">
					<tr>
						<td width="30%">Programming Language:</td>
						<td><%=(domain.getLanguage() != null&&!domain.getLanguage().getValue().equals("null")&&!domain.getLanguage().getValue().equals(""))?domain.getLanguage().getValue():"-" %></td>
					</tr>
					<tr>
						<td>Web server:</td>
						<td><%=(domain.getServer() != null&&!domain.getServer().getValue().equals("null")&&!domain.getServer().getValue().equals(""))?domain.getServer().getValue():"-" %></td>
					</tr>
					<tr>
						<td>Javascript library:</td>
						<td><%=(domain.getJsLib() != null&&!domain.getJsLib().getValue().equals("null")&&!domain.getJsLib().getValue().equals(""))?domain.getJsLib().getValue():"-" %></td>
					</tr>
					<tr>
						<td>IP Address:</td>
						<td><%=(domain.getIp() != null&&!domain.getIp().equals("null"))?domain.getIp():"-" %></td>
					</tr>
					<tr>
						<td>Domain Age:</td>
						<td><%=(domain.getAgeDomain() != null&&!domain.getAgeDomain().getValue().equals("null"))?domain.getAgeDomain().getValue():"-" %></td>
					</tr>
				</table>
				<h3 class="info-menu">Site Contact Info</h3>
				<table width="100%" class="margin-bottom">
					<tr>
						<td width="30%">Email:</td>
						<td><%=(domain.getEmail() != null&&!domain.getEmail().getValue().equals("null"))?domain.getEmail().getValue():"-" %></td>
					</tr>
					<tr>
						<td>Google Analytic:</td>
						<td><%=(domain.getAnalytics() != null&&!domain.getAnalytics().equals("null"))?"<a href='/same-analytic/"+domain.getAnalytics()+"'>"+domain.getAnalytics()+"<a/>":"-" %></td>
					</tr>
					<tr>
						<td>Google Adsense:</td>
						<td><%=(domain.getAdsend() != null&&!domain.getAdsend().equals("null"))?"<a href='/same-adsense/"+domain.getAdsend()+"'>"+domain.getAdsend()+"</a>":"-" %></td>
					</tr>
				</table>
				<h3 class="info-menu">Domain Traffic Graph</h3>
				<table width="100%">
					<tbody>
						<tr>
							<td width="50%">
								<h4>Daily Rank</h4>
								<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=t&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF">
							</td>
							<td>
								<h4>Daily Page Views</h4>
								<img src="http://traffic.alexa.com/graph?c=1&amp;u=<%=domain.getName() %>&amp;r=6m&amp;y=r&amp;z=3&amp;h=200&amp;w=280&amp;b=FFFFFF">
							</td>
						</tr>
					</tbody>
				</table>
				<h3 class="info-menu">Magestic Backlinks:</h3>
				<div class="whois">
					<img style="" alt="Picture shows the External Backlinks found over the last month" title="Picture shows the External Backlinks found over the last month" src="http://www.majesticseo.com/charts/backlinks-discovery?ctype=0&amp;w=600&amp;a=1&amp;h=150&amp;IndexDataSource=F&amp;bc=EAEEF0&amp;d=<%=domain.getName() %>" id="magestic_image">
				</div>
				<h3 class="info-menu">Whois Record for <%=domain.getName() %></h3>
				<div class="whois">
					<%=(domain.getWhois() != null&&!domain.getWhois().getValue().equals("null"))?domain.getWhois().getValue():"No whois" %>
				</div>
			</div>
			<div class="content-right right">
				<%@ include file='/adv/adv300.jsp'%><br/><br/>
				<%@ include file='/element/share.jsp'%>	
				<%@ include file='/element/tool.jsp'%>	
				
					
				
				<div class="blog">
					<div class="blog-header">Near site</div>
				
					<div class="blog-content">
						<ul class="item">
							<%
							if(domain.getNearSite().size()>0)
							{
							%>
								<%
								for(int i=0;i<domain.getNearSite().size();i++)
								{
								%>
									<li><a href="/domain/<%=domain.getNearSite().get(i)%>" title="<%=domain.getNearSite().get(i)%>"><%=domain.getNearSite().get(i)%></a></li> 
								<%
								}
								%>
							<%
							}
							%>
						</ul>      	
						<img src="/images/note.png" alt="domain" class="right"/>
						<div class="clear"></div>	
					</div>
					<br/>
					<iframe src="http://www.facebook.com/plugins/activity.php?site=<%=domain.getName()%>&amp;width=258&amp;height=300&amp;header=false&amp;colorscheme=light&amp;recommendations=false" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:300px; height:300px;" allowTransparency="true"></iframe>
					<div class="b-stickr" style="width: 300px">
					<br/>
					<script src="http://widgets.twimg.com/j/2/widget.js"></script>
					<script>
					new TWTR.Widget({
					  version: 2,
					  type: 'search',
					  search: '<%=domain.getName()%>',
					  interval: 6000,
					  title: 'Your friends on site <%=domain.getName()%>',
					  subject: '',
					  width: 300,
					  height: 227,
					  theme: {
					    shell: {
					      background: '#8ec1da',
					      color: '#ffffff'
					    },
					    tweets: {
					      background: '#ffffff',
					      color: '#444444',
					      links: '#1985b5'
					    }
					  },
					  features: {
					    scrollbar: true,
					    loop: false,
					    live: false,
					    hashtags: true,
					    timestamp: true,
					    avatars: true,
					    toptweets: true,
					    behavior: 'default'
					  }
					}).render().start();
					</script>
					</div>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>
<%@ include file='/layout/footer.jsp'%>	